package com.xmut.mall.auth.controller;

import com.xmut.mall.auth.service.SmsService;
import com.xmut.mall.auth.utils.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private SmsService smsService;

    @GetMapping("/test")
    public String test(){
        return "测试成功";
    }

    /**
     * 发送验证短信
     * @param phone
     * @return
     */
    @GetMapping("/sendCode/{phone}")
    public RespBean sendCode(@PathVariable String phone){
       return smsService.sendCode(phone);
    }
}
